<?php
	$title_meta = '作品详情 | ';
	include ("header.php");
?>

<div class="case">
	<div class="case_bg">
		<img src=""/>
		<!--<div>
			
		</div>-->
		<!--<img src="images/video_btn.png" id="case_btn"/>-->
	</div>
	<div class="content">
		<div>
			<!--<div class="menu fl">
				<img src="images/case_menuline.jpg" class="fl"/>
				<ul class="fl">
					<li class=""><a href="works.php">目录</a></li>
					<li class="prve">上一篇</li>
					<li class="next">下一篇</li>
					<div class="clear"></div>
				</ul>
				<div class="clear"></div>
			</div>-->
			<div class="article fl">
				<h1></h1>
				<h2></h2>
				<p></p>
				<img src=""/>
				<ul class="menu">
					<li class="prve fl"></li>
					<li class="next fr"></li>
					<li class="fr menu_menubtn"><a href="works.php"></a></li>
					<div class="clear"></div>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
	</div>
</div>

<script type="text/javascript">
	function GetArgsFromHref(sHref, sArgName){
      var args    = sHref.split("?");
      var retval = "";
    
      if(args[0] == sHref) /*参数为空*/
      {
           return retval; /*无需做任何处理*/
      }  
      var str = args[1];
      args = str.split("&");
      for(var i = 0; i < args.length; i ++)
      {
          str = args[i];
          var arg = str.split("=");
          if(arg.length <= 1) continue;
          if(arg[0] == sArgName) retval = arg[1]; 
      }
      return retval;
	}
	var postId = GetArgsFromHref(window.location.href,'id');
	$(document).ready(function(){
		$.ajax({
			type:"post",
			url:"./app/index.php?m=index&a=detail",
			data:{'id':postId},
			success:function(ret){
				var articlehtml="";
				var i=0;
				$(".case_bg img").eq(0).attr("src","./app/data/upload/"+ret.banner.url+"");
				$(".article h1").html(ret.post_brand+"-"+ret.post_title);
				if(postId==20){
					$(".article h1").html(ret.post_brand+ret.post_title);
				}
				$(".article h2").html(ret.post_excerpt);
				$(".article p").html(ret.post_content);
				$(".article img").attr("src","./app/data/upload/"+ret.photo.url+"");
				$(".article .menu .prve").html("<a href='#'>上一篇</a>");
				$(".article .menu .next").html("<a href='#'>下一篇</a>");
				$(".article .menu .menu_menubtn").html("<a href='works.php'>目录</a>");
				var nextId = ret.next;
				var prveId = ret.prve;
				$(".next a").click(function(){
					window.location.href ="case.php?id="+nextId+"";
				});
				$(".prve a").click(function(){
					window.location.href ="case.php?id="+prveId+"";
				});
				if(nextId==false){
					$(".article .menu .next").html(" ");
					$(".article .menu .menu_menubtn").css("float","left");
				}
				if(prveId==false){
					$(".article .menu .prve").html(" ");
				}
				var video = ret.video;
				if(!video){
					$(".case_bg img").eq(1).css("display","none");
				};
				var widimg=$(window).width();
				$(".case_bg img").eq(1).css("left","widimg*0.467");
//				$(".case_bg a").attr()
//				var str = eval('(' + ret.vedio + ')');
//				alert(str.path);
//				$(".case_bg img").click(function(){
//					var at = "video.php?id="+postId;
//					location.href = at;	
//				})
			}
			
		})
	}); 
		
	$(".case_bg img").click(function(){
		$.ajax({
			type:"post",
			url:"./app/index.php?m=index&a=getVedio&id="+ postId +"",
			success:function(ret){
				if (ret.status == 0) {
	                alert('暂无视频！');
	                return false;
            	}
				var at = "video.php?id="+postId;
				alert(at)
				location.href = at;	
			}
		});
	})
</script>
<?php
	include ("footer.php");
?>